home *** CD-ROM | disk | FTP | other *** search
- #define STRICT
-
- // Includes standard Windows
- #include <windows.h>
- #include <windowsx.h>
- #include <time.h>
- #include <stdlib.h>
- #include <malloc.h>
- #include <memory.h>
- #include <stdio.h>
-
- // Includes D3D
- #define D3D_OVERLOADS
- #include <ddraw.h>
- #include <d3d.h>
-
- // Includes utilitaires D3D
- #include "d3dmath.h"
- #include "d3dutil.h"
- #include "D3DEnum.h"
-
- #include <d3dx.h>
-
- // Ids Resources
- #include "resource.h"
-
- // Constantes
- #include "const.h"
-
- // Types
- #include "types.h"
-
- // Variables globales projet
- #include "vars.h"
-
- // Prototypes fonctions autres modules
- #include "proto.h"
-
- // Macros
- #include "macros.h"
-
- void vForce3DRefresh(BOOL bFull)
- {
- if (bFull == XDC_MODE_COMPLET)
- hrRender3DEnvironment();
- else
- hrShowFrame();
- }
-
- LRESULT CALLBACK lrPerspWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- switch( uMsg )
- {
- case WM_PAINT:
- // If we get WM_PAINT messages, it usually means our window was
- // covered up, so we need to refresh it by re-showing the contents
- // of the current frame.
- vForce3DRefresh(XDC_MODE_PARTIEL);
- break;
-
- case WM_MOVE:
- // Move messages need to be tracked to update the screen rects
- // used for blitting the backbuffer to the primary.
- if( bActive && bReady )
- vOnMove( (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam) );
- break;
-
- case WM_SIZE:
- // Check to see if we are losing or gaining our window. Set the
- // active flag to match.
- if( SIZE_MAXHIDE==wParam || SIZE_MINIMIZED==wParam )
- bActive = FALSE;
- else bActive = TRUE;
-
- // A new window size will require a new backbuffer size. The
- // easiest way to achieve this is to release and re-create
- // everything.
- if( bActive && bReady )
- {
- bReady = FALSE;
- if( FAILED( hrCloseD3D(FALSE) ) )
- DestroyWindow( hWnd );
-
- if( FAILED( hrInitD3D( hWnd, &gDeviceGUID ) ) )
- DestroyWindow( hWnd );
-
- if (FAILED(hrInitWorld( lpd3dDevice )))
- {
- hrCloseD3D(TRUE);
- DestroyWindow( hWnd );
- }
-
- // Mettre à jour les variables d'état du pipe D3D
- vSetD3DState();
-
- // Remettre en service les lampes
- for (int iCnt = 0 ; iCnt <= iLampLastUsed ; iCnt++)
- if (Lampes[iCnt].bEnabled)
- bUpdateLamp(iCnt);
-
- // Redessiner la scène
- vForce3DRefresh(XDC_MODE_COMPLET);
-
- bReady = TRUE;
- }
- break;
-
- case WM_CHAR : //************************* F R A P P E C L A V I E R ********************
- PostMessage(hWndMenu, uMsg, wParam, lParam);
- break;
-
- case WM_GETMINMAXINFO:
- // Prevent the window from going smaller than some minimum size
- ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 100;
- ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100;
- break;
-
- case WM_NCLBUTTONDBLCLK :
- ShowWindow(hWnd, SW_MAXIMIZE);
- break;
-
- // case WM_CLOSE: // (ne devrait jamais survenir : pas de close gadget)
- case WM_DESTROY:
- // hrCloseD3D(TRUE);
- // PostQuitMessage(0);
- return 0L;
- }
- return DefWindowProc( hWnd, uMsg, wParam, lParam );
- }
-
-